﻿using MahApps.Metro.Controls;
using PLCWpfTest.Common.Extensions;
using PLCWpfTest.ViewModels;
using System.Windows;
using System.Windows.Input;

namespace PLCWpfTest.Views
{
    /// <summary>
    /// LoginWindow.xaml 的交互逻辑
    /// </summary>
    public partial class LoginWindow : MetroWindow
    {
        private readonly LoginViewModel _loginViewModel;
        public LoginWindow(LoginViewModel loginViewModel)
        {
            InitializeComponent();
            DataContext = _loginViewModel = loginViewModel;
            _loginViewModel.RequestClose += _loginViewModel_RequestClose;
        }

        private void _loginViewModel_RequestClose()
        {
            DialogResult = true;
            Close();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }
    }
}